<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
              //symbol，相当于私有属性
              let symbol=Symbol("这是一个symbol");
              let obj={
                   name:"唐玮",
                   [symbol]:"唐玮的名字"
              };
              //对象的遍历要用for in 来遍历，因为对象没有index，直接用forin来遍历
              for (const i in obj) {
                  console.log(i);//name，私有的symbol访问不到
              }
              for (const i of Object.keys(obj)) {
                  console.log(i);//name
              }
              //遍历私有的属性
              for (const i of Object.getOwnPropertySymbols(obj)) {
                  console.log(i);//Symbol(这是一个symbol)
              }
            //遍历所有属性(Reflect.ownkeys)
            for (const i of Reflect.ownKeys(obj)) {
                console.log(i);
            }
    </script>
</body>
</html>